<?php 
global $user;
drupal_add_js(drupal_get_path('theme', 'govideo') . '/js/switch_a.js');
$id = ( is_numeric(arg(2)) ? arg(2) : (is_numeric(arg(1)) ? arg(1) : '' ) );
$ur = arg(0);
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb[] = l(t('Videos'), 'videos');
if($id) {
  $tax = taxonomy_term_load_multiple(array($id));
  if (isset($tax[$id]->field_background['und'][0]['uri'])) { 
    govideo_set_background($tax[$id]->field_background['und'][0]['uri']);
  } else {
    govideo_set_background(govideo_get_background($tax[$id]->vocabulary_machine_name));
  }
  //$breadcrumb[] = l($tax[$id]->name, $ur.'/'.$tax[$id]->name);
  $breadcrumb[] = l($tax[$id]->name, 'taxonomy/term/'.$id);
} else {
  govideo_set_background(govideo_get_background('video'));
}
drupal_set_breadcrumb($breadcrumb);
//print '<pre>'. check_plain(print_r($tax[$id], 1)) .'</pre>';
print '
<div class="clear"></div>
  <!-- White Section small -->
  <div class="whitesec_search">
    <p>'.t('!count Full Quality Downloadable Videos', array('!count' => govideo_get_count_nodes())).'</p>
    '.($user->uid < 1 ? '<a href="'.url('user/register').'" class="join">'.t('Join Now to get them all').'</a>' : '' ).'
    <div class="smallsearch">
      <form action="'.url('search/node').'" id="SearchForm" method="post">
        <input type="text" value="'.t('Enter keyword to search').'" id="searchBox3" name="keys" onblur="if(this.value == \'\') { this.value = \''.t('Enter keyword to search').'\'; }" onfocus="if(this.value == \''.t('Enter keyword to search').'\') { this.value = \'\'; }" class="bar" />
        <input type="submit" name="op" id="SearchSubmit" class="buttonone" value="'.t("Search").'" />
        <input type="hidden" name="form_token" id="edit-search-block-form-form-token" value="'.drupal_get_token("search_form").'"  />
				<input type="hidden" name="form_id" id="edit-search-block-form" value="search_form"  />
      </form>
    </div>
  </div>
<div class="clear"></div>
  <!-- Recent Videos -->
  <div class="recent_videos">
    <div class="recent_head">
      <ul class="videocat">
        <li>Sort By: </li>
        <li><a href="'.url('videos/'.$id).'"'.($ur == 'videos' ? ' class="colr"' : '').'>'.t('Recently Added').'</a></li>
        <li><a href="'.url('most_viewed/'.$id).'"'.($ur == 'most_viewed' ? ' class="colr"' : '').'>'.t('Most Viewed').'</a></li>
        <li class="last"><a href="'.url('top_rated/'.$id).'"'.($ur == 'top_rated' ? ' class="colr"' : '').'>'.t('Top Rated').'</a></li>
        './*<li class="last"><a href="'.url('productiondate/'.(arg(2) ? arg(2) : arg(1))).'">Production Date</a></li>*/'
      </ul>
      <div class="recent_buttons">
        <ul>
          <li class="gridbutn"><a href="#" class="switch_thumb">&nbsp;</a></li>
          './*<li><a href="#" class="previousbtn">&nbsp;</a><a href="#" class="nextbtn">&nbsp;</a></li>*/'
        </ul>
      </div>
    </div>
    <div class="clear"></div>
  ';
?>

<div class="<?php print $classes; ?>">
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <?php print $title; ?>
  <?php endif; ?>
  <?php print render($title_suffix); ?>
  <?php if ($header): ?>
    <div class="view-header">
      <?php print $header; ?>
    </div>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
      <?php print $exposed; ?>
    </div>
  <?php endif; ?>

  <?php if ($attachment_before): ?>
    <div class="attachment attachment-before">
      <?php print $attachment_before; ?>
    </div>
  <?php endif; ?>
   
  <?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

  <?php if ($pager): ?>
    <?php print $pager; ?>
  <?php endif; ?>

  <?php if ($attachment_after): ?>
    <div class="attachment attachment-after">
      <?php print $attachment_after; ?>
    </div>
  <?php endif; ?>

  <?php if ($more): ?>
    <?php print $more; ?>
  <?php endif; ?>

  <?php if ($footer): ?>
    <div class="view-footer">
      <?php print $footer; ?>
    </div>
  <?php endif; ?>

  <?php if ($feed_icon): ?>
    <div class="feed-icon">
      <?php print $feed_icon; ?>
    </div>
  <?php endif; ?>

</div>
<?php //print '<pre>'. check_plain(print_r($tt, 1)) .'</pre>'; ?>
</div>